home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------
- Return canonical form of host name ala c-client (UNIX version).
-
- Args: host -- The host name
-
- Result: Canonical form, or input argument (worst case)
- ----*/
- char *
- canonical_name(host)
- char *host;
- {
- struct hostent *hent;
- char hostname[MAILTMPLEN];
- char tmp[MAILTMPLEN];
- extern char *lcase();
- /* domain literal is easy */
- if (host[0] == '[' && host[(strlen (host))-1] == ']')
- return host;
-
- strcpy (hostname,host); /* UNIX requires lowercase */
- /* lookup name, return canonical form */
- return (hent = gethostbyname (lcase (strcpy (tmp,host)))) ?
- hent->h_name : host;
- }
-
-
-